Precise Inference of Polymorphic Constrained Types

نویسندگان

  • Scott F. Smith
  • Tiejun Wang
چکیده

This paper develops a precise polymorphic type inference algorithm. Several methods for polymorphic type inference have been developed, including let-polymorphism and flow-based approaches such as Agesen’s Cartesian Product Algorithm (CPA). In this paper we focus on the flow-based variety. There is a class of polymorphic behavior which CPA misses: so-called data polymorphism. In the context of imperative object-oriented languages such as Java, data polymorphism is in fact quite common. This paper develops a new extension to CPA, DCPA, which improves on CPA by accurately and efficiently analyzing data polymorphic programs. We develop DCPA in a type-constraint-based setting, prove its type-soundness, and implement the algorithm for the full Java language to test its feasibility in practice. Our test implementation is used to statically verify the correctness of Java downcasts. Initial benchmark results are given which show the algorithm has considerable promise, both in terms of precision and efficiency.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Subtyping Constrained Types

A constrained type is a type that comes with a set of subtyping constraints on variables occurring in the type. Constrained type inference systems are a natural generalization of Hindley/Milner type inference to languages with subtyping. This paper develops several subtyping relations on polymorphic constrained types of a general form that allows recursive constraints and multiple bounds on typ...

متن کامل

Type inference for polymorphic methods in Java-like languages

In mainstream class-based object-oriented languages with nominal types, like C++, Java and C#, typechecking algorithms require methods to be annotated with their parameter types, which are either fixed or constrained by a (nominal) bound. On the contrary, languages like ML, CaML and Haskell use powerful type inference algorithms capable of calculating the type for a function in which parameter ...

متن کامل

Simple Usage Polymorphism

We present a novel inference algorithm for a type system featuring subtyping and usage (annotation) polymorphism. This algorithm infers simply-polymorphic types rather than the constrained-polymorphic types usual in such a setting; it achieves this by means of constraint approximation. The algorithm is motivated by practical considerations and experience of a previous system, and has been imple...

متن کامل

Simple Type Inference for Structural Polymorphism

We propose a new way to mix constrained types and type inference, where the interaction between the two is minimal. By using local constraints embedded in types, rather than the other way round, we obtain a system which keeps the usual structure of an Hindley-Milner type system. In practice, this means that it is easy to introduce local constraints in existing type inference algorithms. Eventho...

متن کامل

Constrained Types and their

A constrained type consists of both a standard type and a constraint set. Such types enable ee-cient type inference for object-oriented languages with polymorphism and subtyping, as demonstrated by Eifrig, Smith, and Trifonov. Until now, it has been unclear how expressive constrained types are. In this paper we study constrained types without universal quantiication. We prove that they accept t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2000